﻿#region License statement
// NJamb, a specification and delta-specification DSL
// Copyright (c) 2010-2011, Mark Knell
// Published under the MIT License; all other rights reserved
#endregion

#region using...
using NJamb.NUnit;
using NJamb.Parser.SpecificationBuilders.SubjectIs.Extensions;
using NJamb.Parser.Subjects.Singular;
using NJamb.Specifications.Simple;
using NUnit.Framework;
#endregion

namespace NJamb.DemoCode.Bowling
{
	[TestFixture]
	public class DaftBowlingFixture : ExperimentOn<Frame>
	{
		[Test]
		public void Spare()
		{
			Try(x => x.Roll(new PerfectRoll()));

			Expecting(That(x => x.IsSpare).WillChangeTo(true),
				That(x => x.PinsUp).WillChangeTo(0),
				That(x => x.Rolls).Is.EqualTo(1).AndLater.Is.EqualTo(2),
				That(x => x.IsStrike).Is.False().Always());

			// arrange
			TestSubject.Roll(null);
		}

		[Test]
		public void Strike()
		{
			Try(x => x.Roll(new PerfectRoll()));

			Expecting(That(x => x.IsStrike).WillChangeTo(true),
				That(x => x.PinsUp).WillChangeTo(0),
				That(x => x.Rolls).Is.EqualTo(0).AndLater.Is.EqualTo(1),
				That(x => x.IsSpare).Is.False().Always());
		}

		protected override Frame TestSubjectFactory()
		{
			return new Frame();
		}
	}
}
